const path = require('path');

module.exports = {
  entry: path.resolve(__dirname, 'index.js'),
  // experiments: {
  //   outputModule: true,
  // },
  output: {
    path: path.resolve(__dirname, 'dist'),
    clean: true,
    pathinfo: false,
    // chunkFormat: 'module',
    // module: true,
  },
  resolve: {
    extensions: ['.jsx', '.js'],
  },
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        use: 'babel-loader',
        include: [path.resolve(__dirname, '../src')],
      },
    ],
  },
  externals: [
    function (ctx, callback) {
      if ('nameOfGlobal' === ctx.request) {
        return callback(null, 'nameOfGlobal', 'var');
      }
      callback();
    },
    // /^(jquery|\$)$/i,
    {
      // script依赖 ：
      // jQuery: ['script http://code.jquery.com/jquery-1.9.1.min.js', 'jQuery'],
      jQuery: 'script jQuery@http://code.jquery.com/jquery-1.9.1.min.js',

      // jQuery: 'var jQuery',
    },
  ],
  mode: 'development', // development production
};
